home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / lfs / lfsStats.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  10.8 KB  |  259 lines

  1. /*
  2.  * lfsStats.h --
  3.  *
  4.  *    Declarations of Lfs stats structure.
  5.  *
  6.  * Copyright 1990 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /cdrom/src/kernel/Cvsroot/kernel/lfs/lfsStats.h,v 1.5 92/03/06 11:56:58 mgbaker Exp $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _LFS_STATS
  19. #define _LFS_STATS
  20.  
  21. /* constants */
  22.  
  23. #define    LFS_STATS_VERSION 1
  24.  
  25. typedef struct LfsStatsCounter {
  26.     unsigned int high;    /* High 32 bits. */
  27.     unsigned int low;    /* Low 32 bits. */
  28. } LfsStatsCounter; 
  29.  
  30. #define LFS_STATS_MAX_SIZE    4096
  31. #define    LFS_STATS_CDIST_BUCKETS    64
  32. #ifdef LFS_STATS_COLLECT
  33. #define    LFS_STATS_INC(counter)    ((++(counter).low == 0) ? (counter).high++ : 0)
  34. #define    LFS_STATS_ADD(counter, count)    \
  35.     ((((counter).low + (count) < (counter).low) ? (counter).high++ : 0),\
  36.         ((counter).low = (counter).low + (count)))
  37. #else
  38. #define    LFS_STATS_INC(counter)    
  39. #define    LFS_STATS_ADD(counter, count)
  40. #endif
  41. /* data structures */
  42. #define LFSCOUNT LfsStatsCounter
  43. typedef struct Lfs_StatsVersion1 {
  44.     int    version;    /* Version number of stats structure. */
  45.     int    size;        /* Size of this structure in bytes. */
  46.     /*
  47.      * Segmented log counts.
  48.      */
  49.     struct LfsLogStats {
  50.     LFSCOUNT segWrites;     /* Number of segmetns writes. */
  51.     LFSCOUNT partialWrites; /* Number of non-full segment writes. */
  52.     LFSCOUNT emptyWrites;   /* Number of empty segment writes. */
  53.     LFSCOUNT blocksWritten; /* Number of blocks written to the log.*/
  54.     LFSCOUNT bytesWritten;   /* Number of active bytes written to the log.*/
  55.     LFSCOUNT summaryBlocksWritten; /* Number of summary blocks written to 
  56.                        * disk. */
  57.     LFSCOUNT summaryBytesWritten; /* Number of summary bytes written. */
  58.     LFSCOUNT wasteBlocks;      /* Number of waste blocks. */
  59.     LFSCOUNT newSegments;      /* Number of new segments requests. */
  60.     LFSCOUNT cleanSegWait;     /* Number of waits for a clean segment. */
  61.     LFSCOUNT useOldSegment;    /* Number of requests that could use old 
  62.                         * segment. */
  63.     LFSCOUNT locks;          /* Number of log was locked. */
  64.     LFSCOUNT lockWaits;   /* Number time we waited to lock log. */
  65.  
  66.     /*
  67.      * The following are for ASPLOS measurements only, and can be removed
  68.      * after that's all over.  Remember to put back the padding entries and
  69.      * zero stuff.  Mary  2/14/92
  70.      */
  71.     LFSCOUNT fsyncWrites;        /* Seg. writes due to fsync. */
  72.     LFSCOUNT fsyncPartialWrites;    /* Partial seg. writes due to fsync. */
  73.     LFSCOUNT fsyncBytes;        /* Bytes fsynced. */
  74.     LFSCOUNT fsyncPartialBytes;    /* Bytes fsynced to partial segs. */
  75.     LFSCOUNT partialWriteBytes;    /* Bytes to disk in partial segs. */
  76.     LFSCOUNT cleanPartialWriteBytes;/* Partial bytes written in cleaning. */
  77.     LFSCOUNT fileBytesWritten;    /* File bytes written to disk. */
  78.     LFSCOUNT cleanFileBytesWritten;    /* File bytes written in cleaning. */
  79.     LFSCOUNT partialFileBytes;    /* File bytes written to partial seg. */
  80.  
  81.     LFSCOUNT padding[7];
  82.     } log;
  83.     /*
  84.      * Checkpoint related counters
  85.      */
  86.     struct LfsCheckPointStats {
  87.     LFSCOUNT count;       /* Number of checkpoints performed. */
  88.     LFSCOUNT segWrites;     /* Number of seg writes during checkpoints. */
  89.     LFSCOUNT blocksWritten; /* Number of log writes during checkpoints. */
  90.     LFSCOUNT bytesWritten; /* Number of bytes written during 
  91.                 * checkpoints. */
  92.     LFSCOUNT totalBlocks; /* Total blocks written to checkpoint area. */
  93.     LFSCOUNT totalBytes;  /* Total bytes written to checkpoint area. */
  94.     LFSCOUNT samples;     /* Stable mem locality samples. */
  95.     LFSCOUNT padding[15];
  96.     } checkpoint;
  97.  
  98.  
  99.     struct LfsLogCleanStats {
  100.     LFSCOUNT startRequests;    /* Number of start cleaning calls. */
  101.     LFSCOUNT alreadyActive;    /* Number of start calls with cleaning 
  102.                  * already active. */
  103.     LFSCOUNT getSegsRequests; /* Number of request to LfsGetSegsToClean */
  104.     LFSCOUNT segsToClean;        /* Number of segs returned to clean. */
  105.     LFSCOUNT numSegsToClean;    /* Number of segments return. */
  106.     LFSCOUNT segReads;        /* Number of segment read in. */
  107.     LFSCOUNT readErrors;            /* Number we got errors reading in. */
  108.     LFSCOUNT readEmpty;        /* Number we found to be empty. */
  109.     LFSCOUNT bytesCleaned;        /* Number of active bytes cleaned. */
  110.     LFSCOUNT cacheBlocksUsed;    /* Number of cache blocks used. */
  111.     LFSCOUNT segWrites;       /* Number of seg writes during cleaning. */
  112.     LFSCOUNT blocksWritten; /* Number of log writes during cleaning. */
  113.     LFSCOUNT bytesWritten;      /* Number of bytes written during 
  114.                 * cleaning. */
  115.     LFSCOUNT summaryBlocksRead;    /* Number of summary blocks read. */
  116.  
  117.     LFSCOUNT padding[16];
  118.     } cleaning;
  119.  
  120.     struct LfsBlockIOStats {
  121.     LFSCOUNT reads;    /* Number of block read. */
  122.     LFSCOUNT bytesReads;    /* Number of bytes read. */
  123.     LFSCOUNT allocs;        /* Calls to Lfs_BlockAllocate. */
  124.     LFSCOUNT fastAllocs;        /* Number fast allocs. */
  125.     LFSCOUNT slowAllocs;        /* Number of slow allocs. */
  126.     LFSCOUNT slowAllocFails; /* Number of slow allocs that failed. */
  127.     LFSCOUNT totalBytesRead; /* Total bytes read. */
  128.     LFSCOUNT totalBytesWritten; /* Total number of bytes written. */
  129.     LFSCOUNT segCacheHits;        /* Reads that hit in the seg cache. */
  130.     LFSCOUNT padding[15];
  131.     } blockio;
  132.  
  133.     struct LfsDescStats {
  134.     LFSCOUNT fetches;    /* Number of descriptor fetches. */
  135.     LFSCOUNT goodFetch;  /* Number of fetches that succed. */
  136.     LFSCOUNT fetchCacheMiss; /* Fetches that missed in the cache. */
  137.     LFSCOUNT fetchSearched;  /* Number of descriptors searched during ftetch. */
  138.     LFSCOUNT stores;    /* Number of descriptor stores. */
  139.     LFSCOUNT freeStores;    /* Number of stores of free descriptors. */
  140.     LFSCOUNT accessTimeUpdate; /* Number of access time updates. */
  141.     LFSCOUNT dirtyList;          /* File put on dirty list. */
  142.     LFSCOUNT truncs;    /* Descriptor truncates. */
  143.     LFSCOUNT truncSizeZero;    /* Truncate to size zero. */
  144.     LFSCOUNT delete;    /* Truncate with delete. */
  145.     LFSCOUNT inits;    /* Descriptor init calls. */
  146.     LFSCOUNT getNewFileNumber; /* Number of calls for getNewFileNumber */
  147.     LFSCOUNT scans;          /* Scans during getNewFileNumber */
  148.     LFSCOUNT free;          /* Number of descriptor frees. */
  149.     LFSCOUNT mapBlocksWritten; /* Descriptor map blocks written. */
  150.     LFSCOUNT mapBlockCleaned;  /* Map blocks cleaned. */
  151.     LFSCOUNT descMoved;          /* Number of descriptor that move. */
  152.     LFSCOUNT descMapBlockAccess;  /* Accesses to desc map blocks. */
  153.     LFSCOUNT descMapBlockMiss;    /* Accesses that missed in cache. */
  154.     LFSCOUNT residentCount;          /* Count of resident blocks at cp. */
  155.     LFSCOUNT cleaningFetch;          /* Fetching during cleaning. */
  156.     LFSCOUNT cleaningFetchMiss;   /* Miss during cleaning. */
  157.     LFSCOUNT padding[11];
  158.     } desc;
  159.     struct LfsIndexStats {
  160.     LFSCOUNT    get;    /* Get file index count. */
  161.     LFSCOUNT    set;    /* Set file index count. */
  162.     LFSCOUNT getFetchBlock; /* Number of indirect blocks fetched by get.*/
  163.     LFSCOUNT setFetchBlock; /* Number of indirect blocks fetched by set. */
  164.     LFSCOUNT growFetchBlock; /* Number of indirect blocks fetched by grow */
  165.     LFSCOUNT getFetchHit; /* Number of indirect blocks found in cache for 
  166.                   * get. */
  167.     LFSCOUNT setFetchHit; /* Number of indirect blocks found in cache for
  168.                   * set. */
  169.     LFSCOUNT truncs; /* Truncate index count. */
  170.     LFSCOUNT deleteFetchBlock; /* Fetching a cache block for delete. */
  171.     LFSCOUNT deleteFetchBlockMiss; /* Reading a cache block for delete. */
  172.     LFSCOUNT getCleaningFetchBlock; /* Fetch an index block for cleaning. */
  173.     LFSCOUNT getCleaningFetchHit;   /* Hit on an index block for cleaning.*/
  174.     LFSCOUNT padding[14];
  175.     } index;
  176.  
  177.     struct LfsFileLayoutStats {
  178.     LFSCOUNT calls;    /* Calls to LfsFileLayoutProc. */
  179.     LFSCOUNT dirtyFiles; /* Number of dirty files fetched. */
  180.     LFSCOUNT dirtyBlocks; /* Number of dirty blocks fetched. */
  181.     LFSCOUNT dirtyBlocksReturned; /* Number of dirty blocks returned. */
  182.     LFSCOUNT filledRegion; /* Number of times we filled a region. */
  183.     LFSCOUNT segWrites;      /* Number writes of file data. */
  184.     LFSCOUNT cacheBlocksWritten;      /* Number of cache block written. */
  185.     LFSCOUNT descBlockWritten;    /* Number of descriptor blocks written. */
  186.     LFSCOUNT descWritten;      /* Number of descriptor written. */
  187.     LFSCOUNT filesWritten;      /* Number of files written. */
  188.     LFSCOUNT cleanings;      /* Number of file layout cleans. */
  189.     LFSCOUNT descBlocksCleaned; /* Number of descriptor blocks we had to 
  190.                  * clean. */
  191.     LFSCOUNT descCleaned; /* Number of descriptors cleaned. */
  192.     LFSCOUNT descCopied;    /* Number of descriptors copied during cleaning. */
  193.     LFSCOUNT fileCleaned; /* Number of files encounted during cleaning. */
  194.     LFSCOUNT fileVersionOk; /* Number of files encounted during cleaning that
  195.                 * could be alive by version number ok. */
  196.     LFSCOUNT blocksCleaned; /* Number of blocks encounted during 
  197.                 * cleaning. */
  198.     LFSCOUNT blocksCopied;  /* Number of blocks copied during cleaning. */
  199.     LFSCOUNT blocksCopiedHit; /* Number of blocks founding in cache 
  200.                   * during cleaning. */
  201.     LFSCOUNT cleanNoHandle;    /* Files deleted while being cleaned. */
  202.     LFSCOUNT cleanLockedHandle; /* File cleaning failed due to locked 
  203.                      * handle. */
  204.     /*
  205.      * These next stats are for ASPLOS paper and can be removed and
  206.      * zeroed after that's done.   Mary 2/15/92.
  207.      */
  208.     LFSCOUNT descLayoutBytes;    /* Descriptor bytes in layout proc. */
  209.  
  210.     LFSCOUNT padding[13];
  211.     } layout;
  212.  
  213.     struct LfsSegUsageStats {
  214.     LFSCOUNT blocksFreed; 
  215.     LFSCOUNT bytesFreed;
  216.     LFSCOUNT usageSet;
  217.     LFSCOUNT blocksWritten;
  218.     LFSCOUNT blocksCleaned;
  219.     LFSCOUNT segUsageBlockAccess;  /* Accesses to usage array blocks. */
  220.     LFSCOUNT segUsageBlockMiss;    /* Accesses that missed in cache. */
  221.     LFSCOUNT residentCount;          /* Count of resident blocks at cp. */
  222.     LFSCOUNT padding[13];
  223.     } segusage;
  224.  
  225.     struct LfsCacheBackendStats {
  226.     LFSCOUNT startRequests;    /* Number of start write-back calls. */
  227.     LFSCOUNT alreadyActive;    /* Number of start calls with write-back 
  228.                  * already active. */
  229.     LFSCOUNT padding[16];
  230.     } backend;
  231.  
  232.     struct LfsDirLogStats {
  233.     LFSCOUNT entryAllocNew;      /* Number of calls to LfsDirLogEntryAlloc for
  234.                    * new entry. */
  235.     LFSCOUNT entryAllocOld;      /* Number of calls to LfsDirLogEntryAlloc for
  236.                    * old entry. */
  237.     LFSCOUNT entryAllocFound; /* Number of calls to LfsDirLogEntryAlloc that
  238.                    * found their entry. */
  239.     LFSCOUNT entryAllocWaits; /* Number of waits in LfsDirLogEntryAlloc. */
  240.     LFSCOUNT newLogBlock; /* Number of new block blocks fetched. */
  241.     LFSCOUNT fastFindFail; 
  242.     LFSCOUNT findEntrySearch;
  243.     LFSCOUNT dataBlockWritten;
  244.     LFSCOUNT blockWritten;
  245.     LFSCOUNT bytesWritten;
  246.                     /* This next is for ASPLOS only.
  247.                      * Remove when done.  -Mary 2/15/92.  */
  248.     LFSCOUNT cleaningBytesWritten;    /* Bytes written during cleaning. */
  249.     LFSCOUNT padding[1];
  250.     } dirlog;
  251.     unsigned int cleaningDist[LFS_STATS_CDIST_BUCKETS];
  252. } Lfs_StatsVersion1;
  253. #undef LFSCOUNT
  254.  
  255. typedef Lfs_StatsVersion1 Lfs_Stats;
  256.  
  257. #endif /* _LFS_STATS */
  258.  
  259.